#include <stdio.h>
#include <stdlib.h>

int main(int argc, int **argv)
{
	int GradeCount, Grade[100001] = {0};
	int FindCount, Find[100001] = {0};
	int Res[101] = {0};
	int i;
	
	scanf("%d", &GradeCount);
	for(i = 0; i < GradeCount; i++)
	{
		scanf("%d", &Grade[i]);
	}

	scanf("%d", &FindCount);
	for(i = 0; i < FindCount; i++)
	{
		scanf("%d", &Find[i]);
	}

	for(i = 0; i < GradeCount; i++)
	{
		Res[Grade[i]]++;
	}

	for(i = 0; i < FindCount; i++)
	{
		printf("%d", Res[Find[i]]);
		if(i != FindCount-1)
		{
			printf(" ");
		}
	}

	return 0;
}